/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cong.timesheet.form;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author Ram
 */
public class LoginForm extends ActionForm{
    private String userName;
    private String password;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
     
        ActionErrors errors=new ActionErrors();
        if(getUserName().isEmpty())
        {
            errors.add("userName", new ActionMessage("errors.required", "User Name"));
            
        }
        return errors;
    }
    
    
}
